package com.cyurs.netty.nettySimple.EncoderAndDecoder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @Author: Cyrus
 * @CreateDate: 2020/11/26
 */
public class MessageToLongEncoder extends MessageToByteEncoder<Long> {

    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("MessageToLongEncoder encoder 被调用");
        System.out.println("msg=" + msg);
        out.writeLong(msg);
    }
}
